package com.yys.gulimall.search.web;/*
 * @author zq
 */

import com.yys.gulimall.search.service.MallSearchService;
import com.yys.gulimall.search.vo.SearchParam;
import com.yys.gulimall.search.vo.SearchResult;
import org.elasticsearch.search.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String list(SearchParam searchParam, Model model) {
        /**
         * es 中获取结果
         * 渲染到页面上
         * */
        SearchResult result = mallSearchService.search(searchParam);
        model.addAttribute("result",result);
        return "list";
    }
}
